<template>
  <view class="content">
    <view class="login-bg">
      <view class="login-card">
        <u-form ref="uForm" :labelWidth="180" v-if="userinfo">
          <u-form-item label="用户号:" prop="name">
            {{ userinfo.name }}
          </u-form-item>
          <u-form-item label="手机号:" prop="phoneNum">
            {{ userinfo.phonenum }}
          </u-form-item>
					<u-form-item label="单位名称:">
            {{ userinfo.unitname }}
          </u-form-item>
          <u-form-item label="地址:">
            {{ userinfo.addr }}
          </u-form-item>
        </u-form>
      </view>
    </view>
  </view>
</template>

<script>
import api from '@/api/api.js'
export default {
  data() {
    return {
			userinfo: null
    };
  },
  onLoad() {
		this.getUserInfo();
	},
  methods: {
		async getUserInfo () {
			const openid = uni.getStorageSync('openid');
			const res = await api.getUserByOpenId({ openId: openid })
			this.userinfo = res.userinfo;
		}
  },
};
</script>

<style lang="scss">
.content {
  position: relative;
  .login-bg {
    height: 100vh;
    padding: 25upx;
    background: linear-gradient(#4790ef, #86b5f4);
    .login-card {
      position: relative;
      min-height: 560upx;
      background: #fff;
      border-radius: 12upx;
      padding: 25upx 25upx 25upx 35upx;
      box-shadow: 0 6upx 18upx rgba(0, 0, 0, 0.12);
    }
  }
}
</style>
